<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>create class</title>
    <link rel="stylesheet" type="text/css" href="css1.css" />
    <script>
        class Star {
            constructor(name,age){
                this.name = name;
                this.age = age;
            }
            say(){
                console.log(`我叫${this.name},我今年${this.age}岁了`)
                return this.name+this.age
            }
        }  
        let call = () => {
            var name = document.getElementById('name1').value
            var age = document.getElementById('age1').value
            let l1 = new Star(name,age)
            document.getElementById('show').value = l1.say()
        }
    </script>

    <body>
        <input type = "text" id = "name1" value = "刘德华">
        <input type = "text" id = "age1" value = "58">
        <input type="button" value="点击" onclick="call()">
        <input type="text"  id="show">
    </body>
</html>